import { App } from 'vue'
import { ElButton, ElMessage } from 'element-plus'
import 'element-plus/lib/theme-chalk/index.css'

const components = [ElButton]

const ElementPlus = {
  install: (app: App<Element>) => {
    components.forEach((component) => app.component(component.name, component))
    window.$tip = async (type: TipType, message: string) => {
      ElMessage({
        type,
        message,
        offset: 70,
        onClose: () => Promise.resolve()
      })
    }
  }
}

export default ElementPlus
